﻿/************************************
Authors
Tandin Wangchuk (u3057074) & Hesham (u567890)
Assignment 2
15/04/2011
***********************************
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace MyPhotoShop
{
    public partial class ImageInfo : Form
    {
        private string bitMapPath;
        private Bitmap currentBitmap;
        public ImageInfo(string bitmapPath, Bitmap cBitmap)
        {
            InitializeComponent();
            this.bitMapPath = bitmapPath;
            this.currentBitmap = cBitmap;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void ImageInfo_Load(object sender, EventArgs e)
        {
            FileInfo fileInfo = new FileInfo(this.bitMapPath);
            lblImageName.Text = fileInfo.Name.Replace(fileInfo.Extension, "");
            lblImageExtension.Text = fileInfo.Extension;
            string location = fileInfo.DirectoryName;
            if (location.Length > 50)
                location = location.Substring(0, 15) + "..." + location.Substring(location.LastIndexOf("\\"));
            lblImageLocation.Text = location;
            lblImageDimension.Text = currentBitmap.Width + " x " + currentBitmap.Height;
            lblImageSize.Text = (fileInfo.Length / 1024.0).ToString("0.0") + " KB";
            lblImageCreatedOn.Text = fileInfo.CreationTime.ToString("dddd MMMM dd, yyyy");
        }
    }
}
